import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-10-29
 * Time: 20:30
 */
public class test_2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int m = in.nextInt();
            int top=0;
            int[] nums = new int[100001];
            for (int i = 0; i < n; i++) {
                int x = in.nextInt();
                nums[x]++;
                top=Math.max(top,nums[x]);
            }

            for (int i = 1; i <= top; i++) {

                int team = 0;

                for (int j = 0; j < 100001; j++) {
                    if (nums[j] % i != 0) {
                        team++;
                    }
                    team += nums[j] / i;
                }
                if (team <= m){
                    System.out.println(i);
                    return;
                }
            }
            System.out.println(-1);
        }
    }
}
